package LC;

/**
 * @ClassName LC303
 * @Description: TODO
 * @Author hl
 * @Date 2020/8/11
 * @Version V1.0
 **/
public class LC303 {
    int [] sum;
    public LC303(int[] nums) {
        sum=new int[nums.length];
        sum[0]=nums[0];
        for(int i=1;i<nums.length;i++){
          sum[i]=nums[i]+sum[i-1];
        }
    }

    public int sumRange(int i, int j) {
     return  sum[j]-sum[i];
    }
}
